<template>

  <!-- 展示列表项内容 -->
  <van-cell :to="`/article/${article.art_id}`" class="article-item">
    <div slot="title"
      class="title van-multi-ellipsis--l2">{{article.title}}</div>
    <div slot="label" class="label-wrap">
      <!-- 显示三张图片的时候 -->
      <div class="img-wrap"
        v-if="article.cover.type === 3">
        <van-image v-for="(img,index) in article.cover.images"
          :key="index"
          fit="cover"
          width="100"
          height="100"
          :src="img" />
      </div>

      <span>{{article.aut_name}}</span>
      <span>{{article.comm_count}}评论</span>
      <span>{{article.pubdate | relativeTime}}</span>
    </div>

    <van-image class="rigth-img"  v-if="article.cover.type === 1"
      slot="default"
      fit="cover"
      :src="article.cover.images[0]" />
  </van-cell>

</template>

<script>
export default {
  name: 'ArticleItem',
  props: {
    article: {
      type: Object,
      required: true
    }
  },
  data () {
    return {

    }
  }
}
</script>

<style lang="less" scoped>
.article-item {

  border-bottom: 1px solid #edeff3;
  // 文章标题
  .title {
    font-size: 32px;
    color: #3a3a3a;
  }
  // 左侧文本
  .van-cell__title {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  // 单图封面图
  .van-cell__value{
    flex: unset;
    width: 232px !important;
    height: 146px;
    padding-left: 25px;
  }
  // 右边图片
  .rigth-img{
    width:  232px;
    height: 146px;
  }
  // 底部文本信息
  .label-wrap span {
     font-size: 23px;
    color: #b4b4b4;
    margin-right: 25px;
  }
  .img-wrap{
    display: flex;
    padding: 30px 0;
    .van-image{
      flex: 1;
      height: 100%;
    }
    .van-image:nth-of-type(2) {
      padding: 0 4px;
    }
  }
}
</style>
